/*
 *  client_main.c
 */

#include <gtkmm.h>
#include <gtkmm/application.h>
#include <gtkmm/window.h>
#include "../../common/src/debug.h"
#include "client_app.h"
#include "connection_window.h"

/*
#define ERR_DISCONNECTED    1
#define ERR_PARAM_LEN       2
#define ERR_PARAM           3
#define ERR_SOCKET          6
#define ERR_CONNECT         7

#define MSG_DISCONNECTED   "Se ha perdido la conexion."
#define MSG_PARAM_LEN      "Cantidad de parametros incorrecta."
#define MSG_PARAM          "Parametros invalidos."
#define MSG_SERVER         "Error de conexion"

*/

#define RUN_OK 0

int main(int argc, char *argv[]) {
    try {
        
        ClientApp client;
       	Glib::RefPtr<Gtk::Application> gtkApp =
      	        Gtk::Application::create(argc,
                                         argv,
                                         "ar.uba.fi.bzp-client",
                                         Gio::APPLICATION_HANDLES_COMMAND_LINE);
	    Glib::RefPtr<Gtk::Builder> builder =
		        Gtk::Builder::create_from_file("./client/src/gui.glade");
    	ConnectionWindow* win_connection = NULL;
    	builder->get_widget_derived("ConnectionWindow", win_connection);
        win_connection->setApp(&client);
	    gtkApp->run(*win_connection);

  //      client.exec();
        return RUN_OK;
    } catch (...) {
        PRINT("Unknown exception.");
    }
}

//{+}

